package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.SalaryMonthlyReport;
import com.group.project.hrms.mapper.SalaryMonthlyReportMapper;
import com.group.project.hrms.service.ISalaryMonthlyReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class SalaryMonthlyReportService implements ISalaryMonthlyReportService {

    @Autowired
    private SalaryMonthlyReportMapper salaryMonthlyReportMapper;


    @Override
    public int insertSalaryMonthlyReport(SalaryMonthlyReport baseAttendChargeBack) {
        return salaryMonthlyReportMapper.insert(baseAttendChargeBack);
    }

    @Override
    public int deleteSalaryMonthlyReport(SalaryMonthlyReport baseAttendChargeBack) {
        return salaryMonthlyReportMapper.deleteByPrimaryKey(baseAttendChargeBack);
    }

    @Override
    public int updateSalaryMonthlyReport(SalaryMonthlyReport baseAttendChargeBack) {
        return salaryMonthlyReportMapper.updateByPrimaryKey(baseAttendChargeBack);
    }

    @Override
    public SalaryMonthlyReport selectOneSalaryMonthlyReport(SalaryMonthlyReport baseAttendChargeBack) {
        return null;
    }

    @Override
    public List<SalaryMonthlyReport> selectSalaryMonthlyReportByFileMonth(String month) {
        Example example = new Example(SalaryMonthlyReport.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.orLike("fileMonth", "%" + month + "%");
        return salaryMonthlyReportMapper.selectByExample(example);
    }

    @Override
    public List<SalaryMonthlyReport> selectAllSalaryMonthlyReport() {
        return salaryMonthlyReportMapper.selectAll();
    }
}
